package com.chenggcode.simple.jpa.repository;

import com.chenggcode.simple.jpa.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Chenggcode
 * @date 2025/7/1 9:50
 */
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {

    List<User> findByUsernameOrderByCreatedAtDesc(String username);

    List<User> findByUsernameContaining(String username);

    List<User> getTop2ByUsernameContaining(String username);

}
